package com.itheima.sh.dao;

import com.itheima.sh.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
//1.定义接口
public interface UserMapper {
    //2.在接口中定义登录方法
    //3.在登录方法上使用注解查询即可
    @Select("select * from user where username=#{username} and password=#{password}")
    User login(User user);

    //定义按用户名查询用户的方法
    @Select("select * from user where username=#{username}")
    User queryUserByUsername(String username);

    //注册：添加用户
    @Insert("insert into user values(null,#{username},#{password})")
    void register(User user);
}
